<?php require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
require_once($_SERVER['DOCUMENT_ROOT']."/Modules/MGK20XF5/moduleconf.php");
MYDCONN();
	if ($_POST['requestreq_Note'] == '') { $_POST['requestreq_Note'] = 'null'; } else { 
	$_POST['requestreq_Note'] = '"'.$_POST['requestreq_Note'].'"';
	echo '<script charset="utf-8" type="text/javascript">Ext.getCmp(\'win_comconf\').close();</script>';
	}
	if ($GLOBALS['MYD']->db_query("INSERT INTO doccenter_userreads (USER, DOC, TIMEREAD, Dcr_Note)
		VALUES ({$_SESSION[$SESSID]},{$_POST['DOC']},'{$sysTime}',{$_POST['requestreq_Note']})")==true) {
	
		$_UserAlerts = $GLOBALS['MYD']->db_array("SELECT COUNT(REF) AS UnreadComms FROM doccenter_document
WHERE reportreq_Read = 0 AND REF NOT IN (SELECT DOC FROM doccenter_userreads WHERE USER = {$_SESSION[$SESSID]} GROUP BY DOC)");
	if ($_UserAlerts[1]['UnreadComms'] == 0) {
	$_SESSION[$SESSST.'ALT'] = 0;
	}
	echo '<div class="Confirm">Conhecimento registado</div>';	
		
	}